var waiting;
function utilMessage(value){
	art.dialog({
	fixed: true,
	time: 2,
	content: value
	});
}

function succeedMessage(value){
	 art.dialog({
	 fixed: true,
	 time : 2,
	 icon : 'succeed',
	 content :value
	 });

}

function errorMessage(value){
	art.dialog({
	fixed: true,
	time : 2,
	icon : 'error',
	content :value
	});
}

function warningMessage(value){
	 art.dialog({
	 fixed: true,
	 time : 2,
	 icon : 'warning',
	 content :value
	 });

}

function smileMessage(value){
	art.dialog({
	fixed: true,
	time : 2,
	icon : 'face-smile',
	content :value
	});
}

function sadMessage(value){
	art.dialog({
	fixed: true,
	time : 2,
	icon : 'face-sad',
	content :value
	});
}
/**
 * 验证时间大小
 */
function checkEndTime(){  
    var startTime=$("#startTime").val();  
    var start=new Date(startTime.replace("-", "/").replace("-", "/"));  
    var endTime=$("#endTime").val();  
    var end=new Date(endTime.replace("-", "/").replace("-", "/"));  
    if(end<start){  
        return false;  
    }  
    return true;  
}

function checkAll(){
	$(":checkbox").attr("checked", true);  
}
	
function uncheckAll(){
	$(":checkbox").attr("checked", false);  
}
	
function recheckAll(){
	$(":checkbox").each(function () {  
		$(this).attr("checked", !$(this).attr("checked"));
	});
}

function duibi(a, b) {
    var arr = a.split("-");
    var starttime = new Date(arr[0], arr[1], arr[2]);
    var starttimes = starttime.getTime();

    var arrs = b.split("-");
    var lktime = new Date(arrs[0], arrs[1], arrs[2]);
    var lktimes = lktime.getTime();

    if (starttimes >= lktimes) {

        alert('超出了投放期!');
        return false;
    }
    else
        return true;

}


function chcekURL(str_url){
    strRegex = /^(https?|ftp):\/\/(((([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z%]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z%]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z%]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z%]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z%]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z%]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z%]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
    if (strRegex.test(str_url.trim())){
        return (true);
    }else{
        return (false);
    }
}

function charts(obj){
	$this = $(obj);
	$.ajax({
		url: "../login/charts.do",
		dataType: "json",
		async: false,
		success: function(data) {	
			window.parent.frames['right'].location.reload();
		}
	});
}

$(document).ready(function(){
	//操作功能按钮鼠标滑过效果
	var x = 0;  
	var y = 0;

	$('.func a').mouseover(function(e){
		var txt = $(this).text();
		$("#toolTip").show("fast").css({
				"top": (e.pageY+y)-40 + "px",
				"left": (e.pageX+x)-40  + "px"
			}).text(txt);	  //设置x坐标和y坐标，并且显示
    }).mouseout(function(){		
		$("#toolTip").hide();   //移除 
    }).mousemove(function(e){
		$("#toolTip")
			.css({
				"top":(e.pageY+y)-40 + "px",
				"left": (e.pageX+x)-40  + "px"
			});	
	});

});

function doubleType(x)
{
	var f_x = parseFloat(x);
	if (isNaN(f_x))
	{
		f_x=0;
		//alert('function:changeTwoDecimal->parameter error');
		//return false;
	}
	var f_x = Math.round(x*100)/100;
	var s_x = f_x.toString();
	var pos_decimal = s_x.indexOf('.');
	if (pos_decimal < 0)
	{
	pos_decimal = s_x.length;
		s_x += '.';
	}
	while (s_x.length <= pos_decimal + 2)
	{
		s_x += '0';
	}
	return s_x;
}